package com.itbaizhan.mapper;

import com.itbaizhan.pojo.Classes;


import java.util.List;

public interface ClassMapper {
    //一对多  查询班级里的所有学生
    List<Classes> findByClass();
    //查询班级中的学生与老师       classes_teacher是中间表
    /*select * from classes left join
    student on classes.cid = student.sid
    left join classes_teacher on classes.cid = classes_teacher.cid
    left join teacher on teacher.tid = classes_teacher.tid*/
    List<Classes> findAll();

    //一对多分解式查询  主表
    /*
    查询班级时关联查询出学生
    select * from classes;
select * from student where classId = 1;
select * from student where classId = 2;*/
    List<Classes> findAll2();

    //一对一分解式查询  从表
    //根据id查询班级
    /*select * from student
    select * from classes where cid = ?*/
    Classes findById(int cid);
}
